package day10.copy;

import java.io.*;

public class FileCopy {
    public static void main(String[] args) throws IOException {
        File srcFile = new File("src/rs/in.txt");
        File descFile = new File("src/rs/out.txt");
        FileInputStream fis = new FileInputStream(descFile);
        FileOutputStream fos = new FileOutputStream(descFile);
        long start = System.currentTimeMillis();
        int len = -1;
        byte bs[] = new byte[1024];
        while ((len = fis.read(bs))!=-1){
            fos.write(bs,0,len);
        }
        long end = System.currentTimeMillis();
        if(!srcFile.exists()) {
            System.out.println("文件不存在，请确定源文件的路径");
            srcFile.createNewFile();
            System.out.println("复制时间："+(end-start));
        }
    }
}
